home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Shareware / IDimager Personal 4.2.0.3 / setup_IDimager_Personal_V4.exe / {app} / web / modules / publicfunctions.inc < prev    next >
Text File  |  2008-06-21  |  3KB  |  83 lines

  1.   function IsAdmin: Boolean;
  2.   begin
  3.     result := Nvl(SessionData.Prop['IsAdmin'], False);
  4.   end;
  5.  
  6.   function AjaxContainer: String;
  7.   begin
  8.     result := Request.Params.Values['_container'];
  9.   end;
  10.  
  11.   function CurrentUser: WideString;
  12.   begin
  13.     result := Nvl(SessionData.Prop['CurrentUser'],'');
  14.   end;
  15.  
  16.   function CurrentUserGUID: WideString;
  17.   begin
  18.     result := Nvl(SessionData.Prop['CurrentUserGUID'], '');
  19.   end;
  20.  
  21.   function FormatForHTMLEditing (AText: WideString): WideString;
  22.   begin
  23.     result := AText;
  24.  
  25.     result := StrTran(result, '"', '&#' + IntToStr(Ord('"')) + ';');
  26.   end;
  27.  
  28.   function FormatForHTML (AText: WideString): WideString;
  29.   begin
  30.     result := AText;
  31.  
  32.     result := StrTran(result, '"', '&#' + IntToStr(Ord('"')) + ';');
  33.     result := StrTran(result, #10#13, '<br/>');
  34.     result := StrTran(result, #13#10, '<br/>');
  35.  
  36.     result := StrTran(result, ';)' , '<img src="%var:PageOffset\images\smiley_wink.png"  alt=";)" title=";)">');
  37.     result := StrTran(result, ':D' , '<img src="%var:PageOffset\images\smiley_laugh.png" alt=":D" title=":D">');
  38.     result := StrTran(result, ':)' , '<img src="%var:PageOffset\images\smiley_smile.png" alt=":)" title=":)">');
  39.     result := StrTran(result, ':(' , '<img src="%var:PageOffset\images\smiley_sad.png"   alt=":(" title=":(">');
  40.     result := StrTran(result, ':o)', '<img src="%var:PageOffset\images\smiley_clown.png" alt=":o)" title=":o)">');
  41.     result := StrTran(result, ':0' , '<img src="%var:PageOffset\images\smiley_ooo.png"  alt=":0" title=":0">');
  42.     result := StrTran(result, '8)' , '<img src="%var:PageOffset\images\smiley_cool.png"  alt="8)" title="8)">');
  43.     result := StrTran(result, ':$' , '<img src="%var:PageOffset\images\smiley_oops.png"  alt=":$" title=":$">');
  44.     result := StrTran(result, ':*' , '<img src="%var:PageOffset\images\smiley_sick.png"  alt=":*" title=":*">');
  45.     result := StrTran(result, ':''(', '<img src="%var:PageOffset\images\smiley_cry.png"   alt=":''(" title=":''(">');
  46.     result := StrTran(result, ':tooth:' , '<img src="%var:PageOffset\images\smiley_tooth.png"  alt=":tooth:" title=":tooth:">');
  47.   end;
  48.  
  49.   function ThumbCount: Integer;
  50.   begin
  51.     result := 12;    // the number of thumbs per page
  52.   end;
  53.  
  54.   function CanUpdateComment (AGUID: String): Boolean;
  55.   var
  56.     AComment: TCatalogItemComment;
  57.   begin
  58.     result := False;
  59.     if AGUID = '' then
  60.       exit;
  61.  
  62.     result := IsAdmin;
  63.  
  64.     if not result then
  65.     begin
  66.       AComment := TCatalogItemComment.Create(nil);
  67.  
  68.       if Catalog.EnumCommentByGUID (AGUID, AComment) then
  69.         result := (AComment.UserGUID = CurrentUserGUID);
  70.  
  71.       AComment.Free;
  72.     end;    
  73.   end;
  74.  
  75.   function FixTiny (AString: WideString): WideString;
  76.   begin
  77.     result := Trim(AString);
  78.  
  79.     //result := strtran(result, '<p>', '');
  80.     //result := strtran(result, '</p>', '');
  81.   end;
  82.  
  83.